package Chapter2.Comparing.c7;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.InputMismatchException;
import java.util.Scanner;

public class ExceptionTest1 {
    public static void main(String[] args) {
        int a,b,c;
        System.out.println("Please enter two integers: ");
        Scanner scanner = new Scanner(System.in);
        try {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = a/b;
            System.out.println("result is: "+c);

        }
        catch (ArithmeticException e){
            System.out.println("divisor cannot be zero!please re_enter");
        }
        catch (InputMismatchException e) {
            System.out.println("your input is not integer! please re_enter!");
        }
        catch (Exception e) {
            e.printStackTrace();
            System.out.println("please re_enter!");
        }
        finally {
            System.out.println("end of program.");
        }

    }
}
